﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using MobileSales.Model.Employees;
using MobileSales.Model.Params;
using MobileSales.Model.Exceptions;

namespace MobileSales.Server.Services
{
    [ServiceContract(Namespace = "http://MobileSales.Employees")]
    public interface IEmployeeService
    {
        #region Employee management

        [OperationContract]
        Employee GetEmployee(int employeeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreEmployee(Employee employee);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteEmployee(int employeeId);

        [OperationContract]
        IEnumerable<Employee> GetEmployeeList();
        [OperationContract]
        IEnumerable<Employee> GetEmployeeListByContract(int contractId);
        [OperationContract]
        IEnumerable<Employee> GetEmployeeListByRole(int roleId);
        [OperationContract]
        IDictionary<string, int> GetEmployeeLoginList();

        [OperationContract]
        Dictionary<Param, string> GetEmployeeParams(int employeeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreEmployeeParams(int employeeId, Dictionary<Param, string> parameters);

        [OperationContract]
        IDictionary<int, bool> GetEmployeeClients(int employeeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreEmployeeClients(int employeeId, IDictionary<int, bool> employeeClients);

        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void UpdateEmployeeLocation(int employeeId, double latitude, double longitude);

        #endregion

        #region Message management

        [OperationContract]
        Message GetMessage(int messageId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteMessage(int messageId);
        [OperationContract]
        IEnumerable<Message> GetMessageList(int employeeId);
        [OperationContract]
        int CountNewMessages(int employeeId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void SendMessage(int senderId, int recipientId, string subject, string content);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void ReadMessage(int messageId);

        #endregion

        #region Role management

        [OperationContract]
        IEnumerable<Role> GetRoleList();
        [OperationContract]
        Role GetRole(int roleId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreRole(Role role);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteRole(int roleId);

        #endregion

        #region Contract management

        [OperationContract]
        IEnumerable<Contract> GetContractList();
        [OperationContract]
        Contract GetContract(int contractId);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void StoreContract(Contract contract);
        [OperationContract]
        [FaultContract(typeof(ValidationException))]
        void DeleteContract(int contractId);

        #endregion
    }
}
